using System;
using UnityEngine;

public class SubBoxWidgetHandler : MonoBehaviour, IWidget, IHandlerBase
{
	public void SetData(bool _isUp, int _tangramIndex, BlockType _blockType)
	{
		this.isUp = _isUp;
		this.tangramIndex = _tangramIndex;
		if (GameMode.gameMode == GameType.TRIANGLE)
		{
			if (this.isUp)
			{
				this.outline_sprite.spriteName = "outline_triangle_0";
			}
			else
			{
				this.outline_sprite.spriteName = "outline_triangle_1";
			}
		}
		else if (GameMode.gameMode == GameType.SQUARE)
		{
			this.outline_sprite.spriteName = "outline_square";
		}
		else if (GameMode.gameMode == GameType.HEXA)
		{
			this.outline_sprite.spriteName = "outline_hexa";
		}
		else if (GameMode.gameMode == GameType.RHOMBUS)
		{
			this.outline_sprite.spriteName = "outline_rhombus";
		}
		else if (GameMode.gameMode == GameType.TANGRAM)
		{
			this.outline_sprite.spriteName = string.Format("outline_tangram_{0}", _tangramIndex);
		}
		this.SetMesh(_blockType);
		if (_blockType == BlockType.INIT)
		{
			this.outline_sprite.color = new Color32(200, 200, 200, byte.MaxValue);
		}
		else
		{
			this.outline_sprite.color = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
		}
		this.DoDataExchange();
	}

	public void DoDataExchange()
	{
	}

	private void SetMesh(BlockType _blockType)
	{
		if (_blockType == BlockType.INIT)
		{
			this.outline_ren.material.SetFloat("_OriginColor", 1f);
			this.outline_ren.material.SetFloat("_MultiColor", 0f);
			this.outline_ren.material.SetFloat("_WhiteColor", 0f);
		}
		else
		{
			this.outline_ren.material.SetFloat("_OriginColor", 0f);
			this.outline_ren.material.SetFloat("_MultiColor", 1f);
			this.outline_ren.material.SetFloat("_WhiteColor", 1f);
		}
	}

	public void SetOutline(bool isSet)
	{
		this.outline.SetActive(isSet);
	}

	public tk2dSprite outline_sprite;

	public GameObject outline;

	public Renderer outline_ren;

	public bool isUp;

	public int tangramIndex;
}
